package com.jt.controller;

import com.jt.pojo.AxiosPojo;
import com.jt.pojo.User;
import com.jt.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
public class AxiosUserController {
    @Autowired
    private UserService userService;
    /**
     * 查询数据库用户列表数据
     * /axiosUser/findAll
     * List<User>
     */
    @RequestMapping("/findAll")
    public List<User> findAll(){
        return userService.findAll();
    }

    /**
     * 修改数据
     * /user
     */
    @PutMapping("/user")
    public void putUser(@RequestBody AxiosPojo user){
        userService.update(user);
    }

    /**
     * 删除数据
     * /user
     */
    @DeleteMapping("/user/{id}")
    public void DelUser(@PathVariable Integer id){
        userService.delete(id);
    }
}
